import Vue from 'vue'
import Router from 'vue-router'
import Home from './views/home/home.vue'
import Category from './views/category/category.vue'
import Cart from './views/cart/cart.vue'
import Personal from './views/personal/personal.vue'
import Product from './views/product/product.vue'

Vue.use(Router);

const routes = [
  {
    name: 'Home',
    path: '/home',
    component: Home,
    children: [
      {
        name: 'Product',
        path: 'product/:id',
        component: Product
      }
    ]
  },
  {
    name: 'Category',
    path: '/category',
    component: Category
  },
  {
    name: 'Cart',
    path: '/cart',
    component: Cart
  },
  {
    name: 'Personal',
    path: '/personal',
    component: Personal
  },
  {
    path: '*',
    redirect: '/home'
  }
]

export default new Router({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})
